
function widget_topicPickerInit(domNode) {

	/**
	 * @deprecated topicpicker now use the drilldown menu widget
	 */
	/*
	jQuery('.widget-topicpicker')
	.each(function() {
		var topicPicker = jQuery(this);
		var topicPickerLineEdit = jQuery(this).children().get(0);
		if (!topicPickerLineEdit) {
			return;
		}
		jQuery(this).append('<input type="hidden" name="' + topicPickerLineEdit.name + '" value="' + topicPickerLineEdit.value + '" />');
		
		jQuery(topicPickerLineEdit).hide();

		var text = window.babAddonWidgets.getMetadata(topicPickerLineEdit.id).topicName;
		jQuery(this).append('<div>' + text + '</div>');
		topicPickerLineEdit.name = '';
	}
	)
	.click(function() {
		var topicPicker = jQuery(this);
		var topicPickerLineEdit = jQuery(jQuery(this).children().get(0));
		if (!topicPickerLineEdit) {
			return;
		}
		var topicPickerHidden = jQuery(jQuery(this).children().get(1));
		var topicPickerLabel = jQuery(jQuery(this).children().get(2));
		bab_dialog.selectarticle(function(param) {
			topicPickerLabel.text(param['content']);
			topicPickerHidden.val(param['id']);
		}, 'show_topics&selectable_topics&memorize'
		);
	}
	);
	*/
	
	jQuery(domNode).find('.widget-topiccategorypicker')
	.each(function() {
		var categoryPicker = jQuery(this);
		var categoryPickerLineEdit = jQuery(this).children().get(0);
		if (!categoryPickerLineEdit) {
			return;
		}
		jQuery(this).append('<input type="hidden" name="' + categoryPickerLineEdit.name + '" value="' + categoryPickerLineEdit.value + '" />');
		
		jQuery(categoryPickerLineEdit).hide();

		var text = window.babAddonWidgets.getMetadata(categoryPickerLineEdit.id).categoryName;
		jQuery(this).append('<div>' + text + '</div>');
		categoryPickerLineEdit.name = '';
	}
	)
	.click(function() {
		var categoryPicker = jQuery(this);
		var categoryPickerLineEdit = jQuery(jQuery(this).children().get(0));
		if (!categoryPickerLineEdit) {
			return;
		}
		var categoryPickerHidden = jQuery(jQuery(this).children().get(1));
		var categoryPickerLabel = jQuery(jQuery(this).children().get(2));
		bab_dialog.selectarticle(function(param) {
			categoryPickerLabel.text(param['content']);
			categoryPickerHidden.val(param['id']);
		}, 'show_categories&selectable_categories&memorize'
		);
	}
	);

}


window.bab.addInitFunction(widget_topicPickerInit);
